//
//  LCZBaseModel.m
//  PersonalNews
//
//  Created by Golibyo on 15/11/26.
//  Copyright © 2015年 changshuhua. All rights reserved.
//

#import "LCZBaseModel.h"

@implementation LCZBaseModel

+ (NSMutableArray *)baseModelArr:(NSArray *)arr {
    //    先初始化容器arr
    NSMutableArray *modelArr = [NSMutableArray array];
    //    遍历数组
    for (NSDictionary *dic in arr) {
        @autoreleasepool {
            
            //        通过便利构造器来创建对象
            id model =[[self class] basemodelWithDic:dic];
            [modelArr addObject:model
             ];
        }
    }
    return modelArr;
}

+ (instancetype)basemodelWithDic:(NSDictionary *)dic{
    //    通过多态创建对象
    id model = [[[self class] alloc] initWithDic:dic];
    return model;
}

- (instancetype)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}


@end
